# Block quotes
A block quote marker (opens new window) consists of 0-3 spaces of initial indent, plus (a) the character >
together with a following space, or (b) a single character >
not followed by a space.
The following rules define block quotes (opens new window):
- Basic case. If a string of lines Ls constitute a sequence of blocks Bs, then the result of prepending a block quote marker (opens new window) to the beginning of each line in Ls is a block quote (opens new window) containing Bs.
- Laziness. If a string of lines Ls constitute a block quote (opens new window) with contents Bs, then the result of deleting the initial block quote marker (opens new window) from one or more lines in which the next non-whitespace character (opens new window) after the block quote marker (opens new window) is paragraph continuation text (opens new window) is a block quote with Bs as its content. Paragraph continuation text (opens new window) is text that will be parsed as part of the content of a paragraph, but does not occur at the beginning of the paragraph.
- Consecutiveness. A document cannot contain two block quotes (opens new window) in a row unless there is a blank line (opens new window)between them.
Nothing else counts as a block quote (opens new window).
Here is a simple example:
Example 206
Markdown | HTML | Demo |
---|---|---|
|
|
The spaces after the >
characters can be omitted:
Example 207
Markdown | HTML | Demo |
---|---|---|
|
|
The >
characters can be indented 1-3 spaces:
Example 208
Markdown | HTML | Demo |
---|---|---|
|
|
Four spaces gives us a code block:
Example 209
Markdown | HTML | Demo |
---|---|---|
|
|
The Laziness clause allows us to omit the >
before paragraph continuation text (opens new window):
Example 210
Markdown | HTML | Demo |
---|---|---|
|
|
A block quote can contain some lazy and some non-lazy continuation lines:
Example 211
Markdown | HTML | Demo |
---|---|---|
|
|
Laziness only applies to lines that would have been continuations of paragraphs had they been prepended with block quote markers (opens new window). For example, the >
cannot be omitted in the second line of
> foo
> ---
without changing the meaning:
Example 212
Markdown | HTML | Demo |
---|---|---|
|
|
Similarly, if we omit the >
in the second line of
> - foo
> - bar
then the block quote ends after the first line:
Example 213
Markdown | HTML | Demo |
---|---|---|
|
|
For the same reason, we can’t omit the >
in front of subsequent lines of an indented or fenced code block:
Example 214
Markdown | HTML | Demo |
---|---|---|
|
|
Example 215
Markdown | HTML | Demo |
---|---|---|
|
|
Note that in the following case, we have a lazy continuation line (opens new window):
Example 216
Markdown | HTML | Demo |
---|---|---|
|
|
To see why, note that in
> foo
> - bar
the - bar
is indented too far to start a list, and can’t be an indented code block because indented code blocks cannot interrupt paragraphs, so it is paragraph continuation text (opens new window).
A block quote can be empty:
Example 217
Markdown | HTML | Demo |
---|---|---|
|
|
Example 218
Markdown | HTML | Demo |
---|---|---|
|
|
A block quote can have initial or final blank lines:
Example 219
Markdown | HTML | Demo |
---|---|---|
|
|
A blank line always separates block quotes:
Example 220
Markdown | HTML | Demo |
---|---|---|
|
|
(Most current Markdown implementations, including John Gruber’s original Markdown.pl
, will parse this example as a single block quote with two paragraphs. But it seems better to allow the author to decide whether two block quotes or one are wanted.)
Consecutiveness means that if we put these block quotes together, we get a single block quote:
Example 221
Markdown | HTML | Demo |
---|---|---|
|
|
To get a block quote with two paragraphs, use:
Example 222
Markdown | HTML | Demo |
---|---|---|
|
|
Block quotes can interrupt paragraphs:
Example 223
Markdown | HTML | Demo |
---|---|---|
|
|
In general, blank lines are not needed before or after block quotes:
Example 224
Markdown | HTML | Demo |
---|---|---|
|
|
However, because of laziness, a blank line is needed between a block quote and a following paragraph:
Example 225
Markdown | HTML | Demo |
---|---|---|
|
|
Example 226
Markdown | HTML | Demo |
---|---|---|
|
|
Example 227
Markdown | HTML | Demo |
---|---|---|
|
|
It is a consequence of the Laziness rule that any number of initial >
s may be omitted on a continuation line of a nested block quote:
Example 228
Markdown | HTML | Demo |
---|---|---|
|
|
Example 229
Markdown | HTML | Demo |
---|---|---|
|
|
When including an indented code block in a block quote, remember that the block quote marker (opens new window) includes both the >
and a following space. So five spaces are needed after the >
:
Example 230
Markdown | HTML | Demo |
---|---|---|
|
|